﻿using SnakeShop.IRepository;
using SnakeShop.IRepository.UnitOfWork;
using SnakeShop.IService;
using SnakeShop.Model.Entities;
using SnakeShop.Model.FromBody;
using SnakeShop.Model.ViewModels.Basics;
using SnakeShop.Model.ViewModels.UI;
using SqlSugar;
using System.Linq.Expressions;

namespace SnakeShop.Service
{
    public class CoreCmsUserServices : BaseServices<CoreCmsUser>, ICoreCmsUserServices
    {
        private readonly IUnitOfWork _unitOfWork;
        private readonly ICoreCmsUserRepository _dal;
        private readonly ICoreCmsUserGradeServices _userGradeServices;

        public CoreCmsUserServices(IUnitOfWork unitOfWork
            , ICoreCmsUserRepository dal
            , ICoreCmsUserGradeServices userGradeServices)
        {
            _unitOfWork = unitOfWork;
            _dal = dal;
            _userGradeServices = userGradeServices;
        }


        /// <summary>
        ///     根据条件查询分页数据
        /// </summary>
        /// <param name="predicate">判断集合</param>
        /// <param name="orderByType">排序方式</param>
        /// <param name="pageIndex">当前页面索引</param>
        /// <param name="pageSize">分布大小</param>
        /// <param name="orderByExpression"></param>
        /// <returns></returns>
        public async Task<IPageList<CoreCmsUser>> QueryPageAsync(Expression<Func<CoreCmsUser, bool>> predicate,
            Expression<Func<CoreCmsUser, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
            int pageSize = 20)
        {
            return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize);
        }

        public Task<AdminUiCallBack> UpdateBalance(int id, decimal money)
        {
            throw new NotImplementedException();
        }

        public Task<AdminUiCallBack> UpdatePoint(FMUpdateUserPoint entity)
        {
            throw new NotImplementedException();
        }
    }
}
